import * as Vue from 'vue'
import * as VueRouter from 'vue-router'
import Antd from 'ant-design-vue'
import routes from './routers/index'
import './assets/css/app.css'
import './assets/css/font_2892498_jx4p2kkn2w.css'
import {
  DownloadOutlined,
  SearchOutlined,
  ClearOutlined,
  LineChartOutlined,
  PlusOutlined,
} from '@ant-design/icons-vue'
import { confirm } from '@Config/config'
import {
  getItem,
  getUserInfo,
  clearUserInfo,
} from '@Config/server/localStorage'
import store from '@Store'
import Drag from '@Config/server/directives/drag'

// if (getUserInfo()?.website != 'xmGallery') {
//   clearUserInfo()
// }
let router = VueRouter.createRouter({
  history: VueRouter.createWebHashHistory(),
  routes: routes(),
})
let __push = router.push
router.push = (obj) => {
  try {
    return __push(obj)
  } catch (e) {
    confirm({
      title: '访问发生错误！请确认是否有权限访问' + JSON.stringify(obj),
    })
  }
}
let app = Vue.createApp({})
app.use(router)
app.use(Antd)
app.use(store)
app.config.productionTip = false
app.config.globalProperties.pagination_affix_attr = () => {
  return {
    offsetBottom: 0,
  }
}
app.component('DownloadOutlined', DownloadOutlined)
app.component('SearchOutlined', SearchOutlined)
app.component('ClearOutlined', ClearOutlined)
app.component('LineChartOutlined', LineChartOutlined)
app.component('PlusOutlined', PlusOutlined)

app.directive('file-drag', Drag())
app.mount('#app')

export default app
